package com.miaosha.error;

public enum EmBusinessError implements CommonError {
    //通用错误码1000X，错误信息可根据需求通过setErrMsg再次更改
    PARAMETER_VALIDATION_ERROR(10001,"参数不合法"),
    UNKNOWN_ERROR(10002,"未知错误"),

    //2000X为用户信息相关错误定义
    USER_NOT_EXIST(20001,"用户不存在！"),
    USER_LOGIN_FAIL(20002,"登陆失败，用户手机号或密码错误！"),
    USER_NOT_LOGIN(20003,"用户未登录！"),

    //3000X为交易信息错误
    STOCK_NO_ENOUGH(30001,"库存不足")
    ;

    private int errCode;
    private String errMsg;

    private EmBusinessError(int errCode,String errMsg){
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    @Override
    public int getErrCode() {
        return this.errCode;
    }

    @Override
    public String getErrMsg() {
        return this.errMsg;
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
